package com.xmh.myutil.entity;

import java.util.Date;
import java.math.BigDecimal;
import java.util.Map;
import java.util.HashMap;

import com.alibaba.fastjson.JSONObject;

import java.sql.Timestamp;

import lombok.Data;

import java.io.Serializable;

@Data
public class AuthorEntity implements Serializable {

    /**
     * 版本号
     * 表备注：
     */
    private static final long serialVersionUID = 3739149257025052171L;

    /**
     *
     */
    private Integer id;

    /**
     *
     */
    private String realName;

    /**
     *
     */
    private String nickName;

    @SuppressWarnings("unchecked")
    public AuthorEntity(String json) {
        this(JSONObject.parseObject(json, Map.class));
    }

    public AuthorEntity() {
    }

    public AuthorEntity(Map<String, Object> map) {
        if (map == null || map.isEmpty()) {
            return;
        }

        if (map.get("id") != null) {
            id = Integer.valueOf(String.valueOf(map.get("id")));
        }

        realName = (String) map.get("realName");

        nickName = (String) map.get("nickName");

    }

    public Map toMap() {
        Map map = new HashMap();
        map.put("id", id);
        map.put("realName", realName);
        map.put("nickName", nickName);
        return map;
    }


}